<template>
	<view class="">
		<view class="zzdbbox">
			<view class="strongtext xiaobai fonweight">可提现金额 (元)</view>
			<view class="sishi xiaobai margin_top2 fonweight">￥
				<text class="xiaobai fonweight" style="font-size: 70rpx;">{{userInfo.money}}</text>
			</view>
		</view>
		<view class="mainpadding" style="position: relative; top: -110rpx;">
			<view class="tybjs radius mainpadding">
				<view class="ershiba xiaobai">提现金额 (元)</view>
				<view class="flexbetween margin_top2">
					<view class="flexleft">
						<view class="sishi xiaobai margin_top2 fonweight">￥</view>
						<input type="digit" v-model="money" class="xiaobai fonweight"
							style="font-size: 64rpx;height: 80rpx;" />
					</view>
					<view class="ershiba xiaohong" style="min-width: 150rpx;"  @click="money=userInfo.money">全部提现</view>
				</view>
			</view>
			<!-- <view class="mainpadding radius tybjs margin_top">
				<view class="ershiba xiaobai">选择提现方式</view>
				<view class="flexbetween margin_top xiahuaxian">
					<view class="flexleft">
						<view class="margin_right1 wxiocn">
							<image src="../static/image/sysem/wx.png" mode=""></image>
						</view>
						<view class="ershiba xiaobai">微信</view>
					</view>
					<u-icon name="checkmark-circle-fill" color="#F3271C" size="18"></u-icon>
				</view>
				<view class="flexbetween margin_top ">
					<view class="flexleft">
						<view class="margin_right1 wxiocn">
							<image src="../static/image/sysem/zfb.png" mode=""></image>
						</view>
						<view class="ershiba xiaobai">支付宝</view>
					</view>
					<view class="weixz"></view>
				</view>
			</view> -->
			<!-- <view class="mainpadding radius margin_top">
				<view class="ershiba xiaobai">提现说明</view>
				<view class="ershil xiaobai">{{system.withdrawal_des}}</view>
			</view> -->
			<view class="bigbtn " style="margin-top: 180rpx;" @click="submit">提现</view>
			<view class="xiaohong textcenter margin_top sanshier" @click="tzzjl">提现记录</view>
		</view>
	</view>
</template>


<script>
	const httpRequest = require("@/common/httpRequest.js")

	export default {
		data() {
			return {
				userInfo: {},
				money: "",
				system: {},
				pageShow: false,
			}
		},
		onLoad() {
			this.getsystem()
		},
		onShow() {
			this.userinfomsg()
		},
		methods: {
			userinfomsg() {
				httpRequest.request('/api/user/index', 'GET', {}).then(res => {
					this.userInfo = res.data
					this.pageShow = true
				})
			},
			getsystem() {
				httpRequest.request('/api/index/getConfigInfo', 'GET', {}).then(res => {
					this.system = res.data
				})
			},
			submit() {
				if(this.money==""){
					httpRequest.toast("请输入提现积分")
					return false
				}
				if(!this.userInfo.bank_account){
					httpRequest.toast("请绑定银行卡后提现！")
					setTimeout(()=>{
						uni.navigateTo({
							url:"/pages_mypage/xiugaizfb"
						})
					},500)
					return false
				}
				uni.showLoading({
					mask:true,
					title:"请稍后"
				})
				httpRequest.request("/api/user/addWithdrawal", 'GET', {
					price: this.money,
				}).then(res=>{
					uni.hideLoading()
					httpRequest.toast(res.msg)
					if(res.code==1){
						setTimeout(()=>{
							uni.navigateBack(1)
						},500)
					}
				})
			},
			// 跳转提现记录
			tzzjl() {
				uni.navigateTo({
					url: '/pages_mypage/tixianjilu'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.wxiocn {
		width: 32rpx;
		height: 32rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.zzdbbox {
		background-size: 100% 100%;
		padding: 16rpx 30rpx 100rpx;
		box-sizing: border-box;
		background-image: url('https://solarmini.yuntaiqi.com/uploads/20240116/60d244b4de81514a85fa68c5cce39d0a.png');
	}
</style>